﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Datorgrafik_lab1.Models.Airplane
{
    public class AirplanePropeller : IModel
    {
        public VertexPositionColor[] vertices { get; set; }
        public int[] indices { get; set; }

        public AirplanePropeller()
        {
            InitializeVertices();
            InitializeIndices();
        }

        private void InitializeVertices()
        {
            vertices = new VertexPositionColor[6];

            //Propeller
            Color propColor = new Color(240, 7, 30);
            // Top left
            vertices[0] = new VertexPositionColor(new Vector3(-0.5f, 1.5f , 0f ), propColor);
            // Top right
            vertices[1] = new VertexPositionColor(new Vector3(0.5f, 1.5f , 0f ), propColor);
            // Bottom
            vertices[2] = new VertexPositionColor(new Vector3(0f, 0f , 0f ), propColor);

            // Top
            vertices[3] = new VertexPositionColor(new Vector3(0f, 0f , 0f), propColor);
            // Bottom right
            vertices[4] = new VertexPositionColor(new Vector3(0.5f, -1.5f , 0f ), propColor);
            // Bottom left
            vertices[5] = new VertexPositionColor(new Vector3(-0.5f, -1.5f , 0f ), propColor);

        }

        private void InitializeIndices()
        {
            //6 vertices make up 2 triangles which make up our rectangle
            indices = new int[12];

            //Propeller
            #region Propeller
            //Top-Front \/
            indices[0] = 0; //top left;
            indices[1] = 1; // bottom right;
            indices[2] = 2; // bottom left;

            //Top-Back \/
            indices[3] = 1; // top left;
            indices[4] = 0; // top right;
            indices[5] = 2; // bottom right;


            //Bottom-Front /\
            indices[6] = 3; //top left;
            indices[7] = 4; // bottom right;
            indices[8] = 5; // bottom left;

            //Bottom-Back /\
            indices[9] = 3; // top left;
            indices[10] = 5; // top right;
            indices[11] = 4; // bottom right;

            #endregion


        }

    }
}
